<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #canvas {
      background-color: antiquewhite;
    }
  </style>
</head>
<body>

  <canvas id="canvas" width="600" height="700">不兼容</canvas>
  <script>
    // 画布
    const canvas = document.querySelector('#canvas');
    // canvas.width = 300;
    // canvas.height = 150;

    // 画笔
    const ctx = canvas.getContext('2d'); // 2d: 二维 webgl: 三维

    // 颜色
    ctx.fillStyle = 'red';
    
    // 矩形
    ctx.fillRect(20,20,400,200);

  </script>
  
</body>
</html>